
#include "action_func.h"
#include "log.h"
#include "fast_conble_func.h"
#include "mqtt_cli.h"
#include "json_data.h"
#include "device_control_data.h"

#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

int hz_list_project(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_list_space(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_list_region(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;
    log_debug("%s called\n", __func__);
    hz_list_room_get(NULL, filter, config);
    // printf("%s\n", cJSON_Print(roomList_Json));
    // printf("%s\n", cJSON_Print(cJSON_GetObjectItemCaseSensitive(roomList_Json, "roomlist")));

    cJSON *_config = NULL;
    bool status = true;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    if (ret == ERROR_NOT_ID)
    {
        status = false;
    }

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.list, hz_area.region, status, data_json);
    printf("regionlist返回\n");

    cJSON_free(data_json); // 释放母对象即可
}

int hz_list_group(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;
    log_debug("%s called\n", __func__);
    hz_list_group_get(NULL, filter, config);

    cJSON *_config = NULL;
    bool status = true;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    if (ret == ERROR_NOT_ID)
    {
        status = false;
    }

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.list, hz_area.group, status, data_json);
    printf("grouplist返回\n");

    cJSON_free(data_json); // 释放母对象即可
}

int hz_list_scene(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;
    log_debug("%s called\n", __func__);
    ret = hz_list_scene_get(NULL, filter, config);

    cJSON *_config = NULL;
    bool status = true;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    if (ret == ERROR_NOT_ID)
    {
        status = false;
    }

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.list, hz_area.scene, status, data_json);
    printf("scenelist返回\n");

    cJSON_free(data_json); // 释放母对象即可
}

int hz_list_device(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;
    log_debug("%s called\n", __func__);
    ret = hz_list_device_get(NULL, filter, config);

    cJSON *_config = NULL;
    bool status = true;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    if (ret == ERROR_NOT_ID)
    {
        status = false;
    }

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.list, hz_area.device, status, data_json);
    printf("list返回\n");

    cJSON_free(data_json); // 释放母对象即可
}

int hz_detail_project(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_detail_space(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_detail_region(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;
    log_debug("%s called\n", __func__);

    ret = checkRoomJson(id, config);
    printf("ret0:%d\n", ret);
    // log_info("%s", cJSON_Print(config));

    cJSON *_config = NULL;
    bool status = true;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    if (ret == ERROR_NOT_ID)
    {
        status = false;
    }

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.detail, hz_area.scene, status, data_json);

    cJSON_free(data_json); // 释放母对象即可

    // char *msg = cJSON_Print(groupList_Json);
    // printf("list:%s\n", msg);
    // cJSON_free(msg);
}

int hz_detail_group(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;
    log_debug("%s called\n", __func__);
    // log_info("%s", cJSON_Print(filter));
    // log_info("%s", cJSON_Print(config));
    // log_info("%s", cJSON_Print(groupList_Json));

    //  ret = check_groupJson(id, config);  //修改config内容
    //  ret = check_listJson(groupList_Json, "groupId", id, config);
    ret = checkGroupJson(id, config);
    printf("ret0:%d\n", ret);
    // log_info("%s", cJSON_Print(config));

    cJSON *_config = NULL;
    bool status = true;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    if (ret == ERROR_NOT_ID)
    {
        status = false;
    }

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.detail, hz_area.scene, status, data_json);

    cJSON_free(data_json); // 释放母对象即可

    // char *msg = cJSON_Print(groupList_Json);
    // printf("list:%s\n", msg);
    // cJSON_free(msg);
}

int hz_detail_scene(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;
    log_debug("%s called\n", __func__);

    // uint8_t *msg = cJSON_Print(config);
    // printf("%s\n", sceneList_p);
    // check_sceneJson(id, config);
    // ret = check_listJson(sceneList_Json, "moduleid", id, config);
    ret = checkSceneJson(id, config);
    // msg = cJSON_Print(config);
    // printf("test:%s\n", id);
    // printf("%s\n", msg);

    cJSON *_config = NULL;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.detail, hz_area.scene, true, data_json);
    cJSON_free(data_json); // 释放母对象即可
}

int hz_detail_device(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
    int ret = 0;
    // uint8_t _id[33] = {0}; // 有效长度32
    // memset(_id, '0', 20);
    // memcpy(_id + 20, id, 12); // 在传入id前加20个‘0’

    uint8_t *msg = cJSON_Print(config);
    // printf("config:%s\n", msg);  //传入的config为数组，成员为对象，一个对象只含一个键值对即一个属性
    checkDevJson(id, config);
    ret = checkReportJson(id, config);
    msg = cJSON_Print(config);
    printf("ret:%d\n", ret);
    printf("%s\n", msg);
    // mqtt_send_msg(hz_info.detail, hz_area.device, "", 0);
    cJSON *_config = NULL;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.detail, hz_area.device, true, data_json);
    cJSON_free(data_json);
    // mqtt_send_msg(hz_info.detail, hz_area.device, "", 0);
}

int hz_status_project(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_status_space(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_status_region(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_status_group(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_status_scene(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_status_device(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_modify_project(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_modify_space(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_modify_region(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_modify_group(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_modify_scene(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_modify_device(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);

    // uint8_t _id[33] = {0}; // 有效长度32
    // memset(_id, '0', 20);
    // memcpy(_id + 20, id, 12); // 在传入id前加20个‘0’

    // 查找设备类型
    uint16_t deviceType = 0;
    list_getDeviceType(id, &deviceType);
    uint16_t addr = 0;
    list_getShortAddr(id, &addr);

    printf("%s\n", cJSON_Print(config));
    // 获取config的值
    int arraySize = cJSON_GetArraySize(config);
    for (int i = 0; i < arraySize; ++i)
    {
        cJSON *configObject = cJSON_GetArrayItem(config, i);

        // Extract values from the config object
        cJSON *_configObject = cJSON_GetObjectItem(configObject, "CF_OnOff");
        if (_configObject != NULL)
        {
            int cf_on_off = 0;
            if (cJSON_IsNumber(_configObject))
            {
                cf_on_off = _configObject->valueint;
            }
            if (cJSON_IsString(_configObject))
            {
                cf_on_off = atoi(_configObject->valuestring);
            }

            switch (deviceType)
            {
            case 43051: // 色温灯
                /* code */
                light_control_OnOff(addr, cf_on_off);
                break;
            case 43525:
                switch_control_OnOff(addr, cf_on_off);
            default:
                break;
            }
        }

        _configObject = cJSON_GetObjectItem(configObject, "CF_Bright");
        if (_configObject != NULL)
        {
            int cf_bright = 0;
            if (cJSON_IsNumber(_configObject))
            {
                cf_bright = _configObject->valueint;
            }
            if (cJSON_IsString(_configObject))
            {
                cf_bright = atoi(_configObject->valuestring);
            }
            light_control_Bright(addr, cf_bright);
        }
    }

    cJSON *_config = NULL;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.modify, hz_area.device, true, data_json);
}

int hz_control_all(char *id, cJSON *filter, cJSON *config)
{
#if 0  //旧
    int ret = -1;

    log_debug("%s called\n", __func__);

    // 获取filter的值
    int arraySize = cJSON_GetArraySize(filter);
    for (int i = 0; i < arraySize; ++i)
    {
        cJSON *filterObject = cJSON_GetArrayItem(filter, i);

        // Extract values from the config object
        int cf_on_off = cJSON_GetObjectItem(filterObject, "CF_OnOff")->valueint;

        // Process or print the extracted values
        log_debug("filter cf_on_off[%d]\n", cf_on_off);
    }

    // 获取config的值
    arraySize = cJSON_GetArraySize(config);
    for (int i = 0; i < arraySize; ++i)
    {
        cJSON *configObject = cJSON_GetArrayItem(config, i);

        // Extract values from the config object
        int cf_on_off = cJSON_GetObjectItem(configObject, "CF_OnOff")->valueint;

        // Process or print the extracted values
        log_debug("config cf_on_off[%d]\n", cf_on_off);
        if (cf_on_off == 1) // 全部开启
        {
            // uint32_t sen_list[8] = {65542, 65546, 65541, 65544, 65547, 65538, 6, 2};
            FastConbleSceneControl(6);
        }
        else // 全部关闭
        {
            FastConbleSceneControl(2);
        }
    }
#endif
    int ret = 0;
    log_debug("%s called\n", __func__);

    // 执行场景控制里的全屋的“全开”与“全关”场景

    controlAllJson(0, config);
    cJSON *_config = NULL;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.control, hz_area.all, true, data_json);
    cJSON_free(data_json);
    return ret;
}

int hz_control_project(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_control_space(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_control_region(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;
    log_debug("%s called\n", __func__);

    // 执行场景控制里的“全开”与“全关”场景
    uint16_t roomID = 0;
    roomID = strtol(id, NULL, 10);

    controlRoomJson(roomID, config);
    cJSON *_config = NULL;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.control, hz_area.region, true, data_json);
    cJSON_free(data_json);
    return ret;
}

// 传入群组id，config指示控制内容
// 没有控制结果反馈，直接以成功回应
int hz_control_group(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;
    log_debug("%s called\n", __func__);
    // ret = FastConbleGroupControl(atoi(id));

    uint16_t groupID = 0;
    groupID = strtol(id, NULL, 10);
    // if(groupID==0&&errno==EINVAL||groupID==LONG_MAX||groupID==LONG_MIN)
    {
        // 转换失败
    }
    // ret = FastConbleGroupControl(groupID);  此接口有问题，需重新测试
    // ret = FastConbleGroupControl(groupID, 0x2ba8, con1, 6);
    ret = controlGroupJson(groupID, config);
    cJSON *_config = NULL;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.control, hz_area.group, true, data_json);
    cJSON_free(data_json);
    return ret;
}

// 传入场景id号，filter和config为空
// 没有控制结果反馈，直接以成功回应
int hz_control_scene(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;

    int32_t sceneID = 0;
    sceneID = strtol(id, NULL, 10);
    // if(sceneID==0&&errno==EINVAL||sceneID==LONG_MAX||sceneID==LONG_MIN)
    {
        // 转换失败
    }
    // log_debug("%s called\n", __func__);
    // printf("%d\n", atoi(id));

    ret = FastConbleSceneControl(sceneID);

    cJSON *_config = NULL;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.control, hz_area.scene, true, data_json);
    cJSON_free(data_json);
    return ret;
}

int hz_control_device(char *id, cJSON *filter, cJSON *config)
{
    int ret = 0;
    log_debug("%s called\n", __func__);

    // uint8_t _id[33] = {0}; // 有效长度32
    // memset(_id, '0', 20);
    // memcpy(_id + 20, id, 12); // 在传入id前加20个‘0’

    ret = controlDevJson(id, config);

    cJSON *_config = NULL;
    _config = cJSON_Duplicate(config, 1); // 深度复制
    cJSON *data_json = cJSON_CreateObject();
    cJSON_AddStringToObject(data_json, "id", id);
    cJSON_AddItemToObject(data_json, "config", _config);

    // 统一转换接口
    //  jsonValueToMqttIteration(data_json);
    jsonValueToMqttStr(data_json);
    // printf("%s\n", cJSON_Print(data_json));
    char *text = cJSON_Print(data_json);
    cJSON_free(data_json);
    char *text1 = attributeToMqttName(text);
    free(text);
    data_json = cJSON_Parse(text1);
    free(text1);

    mqtt_send_json(hz_info.control, hz_area.device, true, data_json);
    cJSON_free(data_json);
}

int hz_log_project(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_log_space(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_log_region(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_log_group(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_log_scene(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_log_device(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_energy_all(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_energy_project(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_energy_space(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_energy_region(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_energy_group(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_energy_device(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_event_message(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_event_alert(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

int hz_event_fault(char *id, cJSON *filter, cJSON *config)
{
    log_debug("%s called\n", __func__);
}

// 声明函数指针数组并初始化
HzFunctionPointer functionPointers[MQTT_TOPIC_NUMBER] = {
    &hz_list_project,
    &hz_list_space,
    &hz_list_region,
    &hz_list_group,
    &hz_list_scene,
    &hz_list_device,
    &hz_detail_project,
    &hz_detail_space,
    &hz_detail_region,
    &hz_detail_group,
    &hz_detail_scene,
    &hz_detail_device,
    &hz_status_project,
    &hz_status_space,
    &hz_status_region,
    &hz_status_group,
    &hz_status_scene,
    &hz_status_device,
    &hz_modify_project,
    &hz_modify_space,
    &hz_modify_region,
    &hz_modify_group,
    &hz_modify_scene,
    &hz_modify_device,
    &hz_control_all,
    &hz_control_project,
    &hz_control_space,
    &hz_control_region,
    &hz_control_group,
    &hz_control_scene,
    &hz_control_device,
    &hz_log_project,
    &hz_log_space,
    &hz_log_region,
    &hz_log_group,
    &hz_log_scene,
    &hz_log_device,
    &hz_energy_all,
    &hz_energy_project,
    &hz_energy_space,
    &hz_energy_region,
    &hz_energy_group,
    &hz_energy_device,
    &hz_event_message,
    &hz_event_alert,
    &hz_event_fault};
